#define MIN(a,b) ((a < b)? a:b)
#define MAX(a,b) ((a > b)? a:b)

int maxArea(int* height, int heightSize){
    int res = 0, i = 0, j = heightSize - 1;
    while (i < j) {
        int volume = (j-i)*MIN(height[i],height[j]);
        res = MAX(volume, res);
        if (height[i] > height[j]) {
            j--;
        } else {
            i++;
        }
    }
    return res;
}